// 数据库操作
const mongoose = require('mongoose');
// 对象规则验证
const Joi = require('joi');

const {
	Schema
} = mongoose;

// 定义后用户收藏集合规则
const CollectModel = new Schema({
	// 用户id
	user_id: {
		type: mongoose.Schema.Types.ObjectId,
		ref: 'User'
	},
	// 是否收藏
	is_collect: {
		type:Boolean,
		default: false
	},
	// 商品id
	goods_id: {
		type: mongoose.Schema.Types.ObjectId,
		ref: 'Goods'
	}

}, {
	versionKey: false
});

// 收藏集合类
const Collect = mongoose.model('collect', CollectModel, 'collect');


// 导出对象
module.exports = {
	Collect
};
